/*!
\file DManager.h
\brief Contains declaration of DManager.
\ingroup DOT
*/

#ifndef DMANAGER_H
#define DMANAGER_H

#include<QString>
#include<QList>
#include<QStringList>
#include<QPixmap>
#include<QFile>
#include<QTextStream>
#include<QObject>
#include<QProcess>

#include"DNodeData.h"
#include"DEdgeData.h"
#include"ActionCommunicator.h"

/*!
\defgroup DOT DOT Module
This module contains all DOT related classes. Most of those classes revolve simply around string manipulation and management.
*/

/*!
\class DManager
\brief Manages all data used to represent a Graph. It contains DNodeData and DEdgeData objects to represent the Graph's Nodes and Edges.
\ingroup DOT
*/

class DManager: public QObject{
Q_OBJECT
public:
	DManager( QStringList stringList );
	//!< Constructor. \param stringList is a valid representation of the Graph in the DOT language. It is expected to contain a custom pattern.
	~DManager();
	//!< Destructor.
	
	QString toDOT()const;
	//!< Returns a representation of the Graph in the DOT language.
	QPixmap toQPixmap()const;
	//!< Returns a QPixmap representation of the Graph.
	
	ActionCommunicator *communicator(){ return m_communicator; }
	//!< Returns the ActionCommunicator used for this Graph.
private:
	QString m_first;
	QList<DNodeData> m_nodeData;
	QList<DEdgeData> m_edgeData;
	QString m_last;
	ActionCommunicator *m_communicator;
private slots:
	void _addNode( QString nodeData );
	void _addEdge( QString edgeData );
	void _removeNode( int nodeID );
	void _removeEdge( int edgeID );
	void _setNodeOption( int nodeID, QString option, QString value );
	void _setEdgeOption( int edgeID, QString option, QString value );
};

#endif
